package frames.kits;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@Component
public class FirstButton extends JButton {
    @Autowired
    private TextConsole textConsole;
    @Autowired
    private Datas datas;
    @Value("${user.name}")
    private String name;
    public FirstButton() {
        super();

    }
    @PostConstruct
    public void init(){
        this.setText(name);
        this.setBounds(2,2,20,10);
        datas.init();
        this.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                datas.init();
                datas.refresh(20);
            }
        });
    }
}
